package ${packagePath}.controller;

import ${packagePath}.entity.${className};
import com.core.controller.BaseController;
import com.core.plugin.bind.Route;
@Route(controllerKey="/${tableName}",viewPath="/pages/${tableName}")
public class ${className}Controller extends BaseController {

	/**
	 *分页查询(json)
	 */
	public void index() {
		renderJson(${className}.me.JsonPaginate(getPageNo(), getPageSize(),bindConditions()));
	}
	
	/**
	 *分页查询
	 */
	public void queryPage() {
		setAttr("page", ${className}.me.paginate(getPageNo4Url(), getPageSize4Url() , bindConditions()));
		render("${tableName}.jsp");
	}
	
	/**
	 *转跳新增页面
	 */
	public void add() {
		renderJsp("${tableName}Add.jsp");
	}
	
	/**
	 *转跳编辑页面
	 */
	public void edit() {
		setAttr("${tableName}", ${className}.me.findById(getParaToInt(2)));
		renderJsp("${tableName}Update.jsp");
	}
	
	/**
	 *新增一条记录
	 */
	public void save() {
		boolean result = getModel(${className}.class).save();
		renderJson(${className}.me.jsonMap(result));
	}
	
	/**
	 *更新一条记录
	 */
	public void update() {
		boolean result = getModel(${className}.class).update();
		renderJson(${className}.me.jsonMap(result));
	}
	
	/**
	 *删除
	 */
	public void delete() {
		${className}.me.deleteByIds(getPara("ids"));
		renderNull();
	}
	
}
